<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'valuationHistory.label', default: 'ValuationHistory')}"/>
    <title>评估历史</title>
    <style>
    .table>tbody>tr>td{
        vertical-align: middle;
    }
    @media screen and (min-width:1900px) and (max-width:1920px) {
        .flex{
            display: flex;justify-content: center;align-items: center;
        }
    }
    .select2-container .select2-choices .select2-search-field input,.select2-container .select2-choice,.select2-container .select2-choices{

        color: #999;
    }
    </style>
</head>

<body class="fixed-navbar fixed-sidebar">

<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right navFloatRight">
                <ol class="hbreadcrumb breadcrumb">
                     <li><span>CINDATA PLS</span></li>
                    <li class="active">
                        <span>评估历史</span>
                    </li>
                </ol>
            </div>
        </div>
    </div>
</div>

<div class="content animate-panel">
    <div class="row">
        <g:form method="POST" action="index" class="form-horizontal" role="form" id="form">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    <div class="panel-tools">
                        <button class="btn btn-primary btn-xs" type="submit" onclick="text()"><i class="fa fa-search"></i> 查询</button>
                        <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn">
                            <i class="fa fa-times"></i> 重置</button>
                    </div>
                    查询
                </div>

                <div class="panel-body seach-group" id="bug1">

                <div class="row">
                    <div class="form-group col-sm-4">
                        <label class="col-sm-3 control-label">抵押物名称</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" name="name" id="name" value="${params?.name}" placeholder="请输入抵押物名称">
                        </div>
                    </div>
                    <div class="form-group col-sm-4">
                        <label class="col-sm-3 control-label">抵押物类型</label>
                        <div class="col-sm-9">
                            <g:select class="form-control" name="type" id="type" from="${com.cindata.dictionary.CollateralType.list()}" optionKey="code" optionValue="name" noSelection="${['': '请选择抵押物类型']}" value="${params?.type}" />
                        </div>
                    </div>
                </div>
            </div>
        </g:form>
    </div>
    </div>

    <div class="row">
        <div class="hpanel hgreen">
            
             <div class="panel-heading">
                <div class="panel-tools">
                    <!-- <g:link action="create" class="btn btn-info btn-xs"><i class="fa fa-plus"></i>新建</g:link> -->
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                全部押品
            </div>

            <div class="panel-body no-padding">
                <div class="table-responsive">
                    <table cellpadding="1" cellspacing="1" class="table table-striped table-bordered table-hover text-center" id="esateTable">
                        <thead>
                        <tr>
                            <g:sortableColumn property="name" title="抵押物名称" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="type" title="抵押物类型" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="evaluateStatus" title="评估状态" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="evaluateType" title="评估类型" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="totalPrice" title="最新评估价格" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="valuationDate" title="最新评估时间" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="user" title="评估人" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="account" title="所属机构" class="col-md-1 text-center" params="${params}"/>
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${valuationHistoryList}">
                            <tr>
                                <g:if test="${it?.sourceClass == 'estate'}">
                                    <td><g:link controller="${it?.sourceClass}" action="valuationHistoryShow" style="color: #3498DB" class="firstTd" id="${it?.sourceId}">${it?.name ? it?.name : '-'}</g:link></td>
                                </g:if>
                                <g:else>
                                    <td><g:link controller="${it?.sourceClass}" action="show" style="color: #3498DB" class="firstTd" id="${it?.sourceId}">${it?.name ? it?.name : '-'}</g:link></td>   
                                </g:else>
                                <td>${com.cindata.dictionary.CollateralType.findByCode(it?.sourceClass)?.name}</td>
                                <td>${it?.evaluateStatus?.name ? it?.evaluateStatus?.name : '-'}</td>
                                <td>${it?.evaluateType?.name? it?.evaluateType?.name : '-'}</td>
                                <td>${it?.totalPrice ? it?.totalPrice : '-'}</td>
                                <td>${it?.valuationDate ? it?.valuationDate : '-'}</td>
                                <td>${it?.user?.fullName ? it?.user?.fullName : '-'}</td>
                                <td>${it?.account ? it?.account?.name : '-'}</td>
                            </tr>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>

            <div class="panel-footer">
                <div class="pagination">
                    <g:paginate action="index" total="${valuationHistoryCount ?: 0}" params="${params}"/>
                </div>
            </div>
        </div>
    </div>
</div>

<g:javascript>
    
    $(function () {
        $('#datepicker').datepicker({
            language: 'zh-CN'
        });
        $("#datepicker").on("changeDate", function(event) {
            $("#my_hidden_input").val(
                $("#datepicker").datepicker('getFormattedDate')
            )
        });

        $('.input-group.date').datepicker({ });
        $('.input-daterange').datepicker({ });
    });

    //重置按钮
    $("#resetBtn").click(function () {
        $("#name").val("");
        $("#s2id_type span:first").html("请选择抵押物类型");
        $("#type").val("");
    });
</g:javascript>

</body>
</html>
